Example Database
Let's explore the database example used in this course.
We'll cover the following
Most of the topics in this course are illustrated using a database for a hypothetical bug-tracking application. The DDL and the ERD for the mentioned application are given below.
Data Definition Language for the database#
The following Data Definition Language shows how tables are defined. In some cases, choices are made for the sake of examples later in the course, so they might not always be the choices one would make in a real-world application. Mostly, only standard SQL is used, so the example is applicable to any brand of the database. Some MySQL data types also appear, such as SERIAL
and BIGINT
. The DDL for the database can be seen below. We can also copy and/or download the code.
Entity-Relationship Diagram for the database#
The Entity-Relationship Diagram for
this database is shown in the figure given below. Notice the three connections between the Bugs
table and the Accounts
table, representing three separate foreign keys.
In some chapters, especially those on Logical Antipatterns, different database definitions are shown, either to exhibit the antipattern or to show an alternative solution that avoids the antipattern.